package com.xianggu.designMode.chainMethod.demo03.impl;

import com.xianggu.designMode.chainMethod.demo03.Order;
import com.xianggu.designMode.chainMethod.demo03.OrderHandler;
import com.xianggu.designMode.chainMethod.demo03.OrderResult;

// 物流校验处理器
public class ShippingHandler extends OrderHandler {
    @Override
    protected OrderResult doHandle(Order order) {
        if (isAddressValid(order.getShippingAddress())) {
            return OrderResult.success();
        }
        return OrderResult.fail("地址不可达", "ShippingCheck");
    }

    private boolean isAddressValid(String address) {
        // 模拟地址校验逻辑
        return !address.contains("火星");
    }
}